<script>
import { mapState, mapGetters } from 'vuex'
export default {
  computed: {
    // ...mapState({
    //   items: state => state.cart.items
    // }),
    ...mapState('cart', ['items']),
    ...mapGetters('cart', ['allCartInfo', 'totalPrice'])
  }
}
</script>

<template>
  <div>
    <h1>购物车</h1>
    <hr>
    <ul>
      <li v-for="info in allCartInfo">
        {{info.name}} - ￥{{info.price}} * {{info.quantity}} = ￥{{info.price * info.quantity}}
      </li>
    </ul>

    <div>总价：￥{{totalPrice}}</div>
  </div>
</template>

<style lang="scss">
  
</style>
